package com.lrkj.back.service.impl;

import java.util.List;
import java.util.Map;

import com.lrkj.back.mapper.ZsEquipCeshiMapper;
import com.lrkj.back.entity.ZsEquipCeshi;
import com.lrkj.back.service.ZsEquipCeshiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.com.cbons.mamisay.parent.db.api.DBInterface;
import cn.com.cbons.mamisay.parent.exception.DBException;
import cn.com.cbons.mamisay.parent.service.base.ParentServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Transactional
@Service("equipCeshiService")
public class ZsEquipCeshiServiceImpl extends ParentServiceImpl<ZsEquipCeshi> implements ZsEquipCeshiService {

    @Autowired
    private ZsEquipCeshiMapper zsEquipCeshiMapper;

    @Override
    protected DBInterface<ZsEquipCeshi> getDao() throws DBException {
        return zsEquipCeshiMapper;
    }

    @Override
    public PageInfo<ZsEquipCeshi> findByDateAndHegeAndState(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<ZsEquipCeshi> tbList = zsEquipCeshiMapper.findByDateAndHegeAndState(map);
        PageInfo<ZsEquipCeshi> page = new PageInfo<ZsEquipCeshi>(tbList);
        return page;
    }

    @Override
    public List<ZsEquipCeshi> findByDateHegeState(Map<String, Object> map) throws DBException {
        return zsEquipCeshiMapper.findByDateAndHegeAndState(map);
    }

    @Override
    public void updateEndtimeAndState(Map<String, Object> map) throws DBException {
        zsEquipCeshiMapper.updateEndtimeAndState(map);
    }

    @Override
    public int updateCeshi(Map<String, Object> map) throws DBException {
        return zsEquipCeshiMapper.updateCeshi(map);
    }

    @Override
    public ZsEquipCeshi findOne(Map<String, Object> map) throws DBException {
        return zsEquipCeshiMapper.findOne(map);
    }
}
